package spring.module.zipfilter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 配置
 *  
 * @author Lucky Yang
 */
@Configuration
public class GZIPConfig {
    @Bean
    public FilterRegistrationBean<GZIPFilter> gzipFilerRegistrationBean() {
        FilterRegistrationBean<GZIPFilter> registration = new FilterRegistrationBean<>();
        registration.setFilter(new GZIPFilter());
        //过滤器名称
        registration.setName("gzipFilter");
        //拦截路径
        registration.addUrlPatterns("/*");
        //设置顺序
        registration.setOrder(1);        
        return registration;
    }
}
